package com.wfx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wfx.entity.Result;
import com.wfx.entity.ViewGoodsCustomer;
import com.wfx.mapper.ViewGoodsCustomerMapper;
import com.wfx.service.IViewGoodsCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.ws.Action;

/**
 * <p>
 * VIEW 服务实现类
 * </p>
 *
 * @author zhu
 * @since 2021-01-28
 */
@Service
public class ViewGoodsCustomerServiceImpl extends ServiceImpl<ViewGoodsCustomerMapper, ViewGoodsCustomer> implements IViewGoodsCustomerService {
    @Autowired
    private ViewGoodsCustomerMapper viewGoodsCustomerMapper;
    //根据商品id查询商户
    @Override
    public Result<ViewGoodsCustomer> findCustomer(String goodsId) {
        QueryWrapper<ViewGoodsCustomer> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("id",goodsId);
        ViewGoodsCustomer viewGoodsCustomer = viewGoodsCustomerMapper.selectOne(queryWrapper);
        if (viewGoodsCustomer == null) {
            return new Result<>(false,"数据为空");
        }
        return new Result<>(true,"查询成功",viewGoodsCustomer);
    }
}
